package com.guandata.cdc.model.db_type.postgres;

import com.guandata.cdc.model.sink.AbstractSinkConfig;
import lombok.ToString;
import org.apache.flink.api.java.utils.ParameterTool;

@ToString
public class PostgresSinkConfig extends AbstractSinkConfig {
    public final String sinkSchema;

    public final String sinkJdbcUrl;

    public final String connector = "jdbc";

    public PostgresSinkConfig(ParameterTool parameterTool) {
        super(parameterTool);
        this.sinkSchema = parameterTool.getRequired("sink.schema");
        this.sinkJdbcUrl = String.format(
            PostgresConst.DEFAULT_JDBC_URL_PREFIX,
            sinkHostName,
            sinkPort,
            sinkDatabaseName
        );
    }
}
